define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	
	
	var Model = function(){
		this.callParent();
	};

	Model.prototype.backBtnClick = function(){
		this.comp("windowReceiver1").windowEnsure();
		this.getParentModel().goBackCommunity();
	};
	
	
	
	Model.prototype.open = function(event) {
		var row = event.bindingContext.$object;
		console.log("row",row.val("title"));
		var imageUrl = this.getImageUrl(row.val("image"));
		var option = {
		        type:"flow",
				title:row.val("title"),
				content:row.val("content"),
				updateDate:row.val("updateDate"),
				image:imageUrl
		};
		justep.Shell.showPage("$UI/communityOto/community/channel/template.w",option);
	};
	
	Model.prototype.flowListDataCustomRefresh = function(event){
	    var url = "http://www.xjzlhy.com:81/ex_community/a/api/community/getNewsByCategoryId?callback=?&category.id=333";
	    var id = JSON.parse(localStorage.getItem("userInfo")).data[2].id;
	    $.getJSON(
	    url,
	    {
		  "office.id":id
		},
	    function(data){  
	    	
    			
	    	event.source.loadData(data.data);
	    	
	    
	    });

	};
	
	Model.prototype.getImageUrl = function(path){
		return "http://www.xjzlhy.com:81"+path;
	};
	
	
	Model.prototype.onTouchStart = function(event){
	
	     $(event.currentTarget).addClass("touch");

	};
	
	
	
	Model.prototype.onTouchEnd = function(event){
		$(event.currentTarget).removeClass("touch");
	};
	
	
	return Model;
});